package com.pc.controller;

import com.pc.enrty.ShoppingAddress;
import com.pc.enrty.User;
import com.pc.pojo.Basic;
import com.pc.service.ShoppingAddressService;
import com.pc.service.UserService;
import com.pc.util.ResultObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController
@RequestMapping("/address/")
public class ShoppingAddressController {
    @Autowired
    private ShoppingAddressService shoppingAddressService;
    @Autowired
    private UserService userService;
    @Autowired
    private ResultObject result;

    /**
     * 根据uid查找收货地址
     * @return
     */
    @RequestMapping("find")
    public ResultObject findById(ShoppingAddress shoppingAddress){
        return result;
    }

    /**
     * 添加收货地址,根据uid将sname修改到user表中的nickname
     * @return
     */
    @RequestMapping("add")
    public ResultObject addAddress(ShoppingAddress shoppingAddress){
        return result;
    }

    /**
     * 根据uid修改收货地址
     * @return
     */
    @RequestMapping("update")
    public ResultObject updateAddress(ShoppingAddress shoppingAddress){
        return result;
    }

    @RequestMapping("findbasic")
    public ArrayList<Basic> findbasic(User user) {


        return  userService.qureyPhoneById(user);
    }
}
